/*
 * Copyright (C), 2019, 派光信息技术有限公司
 * Description: 供需深圳下坪场系统
 */
package com.zf.wms.nservice.conf;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @Description: Swagger 配置
 * @Author: Mine
 * @CreateDate: 2019/2/28 12:22
 * @email: 1943511692@qq.com
 * @Version: 1.0.0
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .groupName("正方WMS平台服务PC-Api")
                .select()
                //加了ApiOperation注解的类，生成接口文档
                .apis(RequestHandlerSelectors.basePackage("com.zf.wms.nservice.controller")).paths(PathSelectors.any())
                //包下的类，生成接口文档
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("Api")
                .description("Api文档")
                .termsOfServiceUrl("http://127.0.0.1:8846")
                .version("1.0.0")
                .build();
    }

}
